home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / mike40c.arc / PUTMSG.C < prev    next >
Text File  |  1986-10-24  |  2KB  |  49 lines

  1. /**********************************************************
  2.  * title: put_screen.c                                    *
  3.  * put attribute, char array to screen buffer             *
  4.  **********************************************************/
  5. put_screen(buf, attrib, rowstart, colstart, pag)
  6. char    *buf;                     /* text buffer(aranged in col-row order */
  7. unsigned int    attrib;        /* attribute to be assigned to text */
  8. int    rowstart;               /* row position within screen (0,...) */
  9. int    colstart;                /* column position within screen  */
  10. int    pag;                 /* Video text page */
  11. {
  12.     char    tempbuf[161];        /* combined data-attribute buffer for one line */
  13.     char    *mbufptr, *interleave();    /* pointer into source buf */
  14.     int    base, index;           /* indexs into screen buffer */
  15.     int    i;                      /* row counter */
  16.     int  rowsize = 1, colsize;
  17.  
  18.     colsize = strlen(buf);
  19.     mbufptr = buf;
  20.     base = (rowstart * 80) + colstart;
  21.     for (i = 0; i < rowsize; i++) {
  22.         mbufptr = interleave(mbufptr, attrib, tempbuf, colsize);
  23.         index = base + (i * 80);
  24.         putsc(tempbuf, index, colsize, pag);    /* no-snow buff,start,length */
  25.     }
  26. }
  27.  
  28. /**********************************************************
  29.  * title: interlv.c                                       *
  30.  * interleaves character with attribute into screen buff  *
  31.  * returns pointer into buffer where we left off          *
  32.  **********************************************************/
  33. char    *interleave(aa, b, c, count)  /* returns new pointer into source buffer */
  34. char    *aa;                          /* pointer into source buffer */
  35. unsigned int    b;                   /* attribute to interleave */
  36. char    *c;                           /* pointer to destination buffer */
  37. int    count;                        /* number of chars to process */
  38. {
  39.     register int    i;                 /* group counter */
  40.  
  41.     for (i = 0; i < count; ++i) {
  42.         *c++ = *aa++;                   /* place data */
  43.         *c++ = b;                      /* place attrib */
  44.     }
  45.     return aa;
  46. }
  47.  
  48.  
  49.